<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link rel="stylesheet" type="text/css" href="{{CDN}}/easyui/themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="{{CDN}}/easyui/themes/icon.css">
		<script type="text/javascript" src="{{CDN}}/easyui/jquery.min.js"></script>
		<script type="text/javascript" src="{{CDN}}/easyui/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="{{CDN}}/easyui/locale/easyui-lang-zh_CN.js"></script>
		<script>

		$(function(){
					
			/*表格初始化*/
			$("#grid").datagrid({
				singleSelect:true,
				fit:true,
				fitColumns:true,
				collapsible:true, 
				striped:true,
				rownumbers:true, 
			    columns:[[    
			    	{field:'CK',checkbox:true},
			        {field:'data_source_code',title:'数据源编码',width:50,align:'center'},    
			        {field:'original',title:'源证书名称',width:150,align:'left'},    
			        {field:'target',title:'映射名称',width:450,align:'left'}    
				]],
				queryParams:{data_source_code:$("#data_source_code").textbox("getValue")},
				url:'/commonDict/noLevelMatch/getNoLevelMatchList',
			    pagination:true,
			    pageSize:30,
			    pageList:[10,20,30,50,100,200,500]
			});
			
			//查询按钮
			$("#search_btn").click(function(){
				$("#grid").datagrid({
					//url:'/commonDict/absMatch/getMatchList',
					queryParams:{data_source_code:$("#data_source_code").textbox("getValue")}
				});
			});
			
			
			
			//修改按钮
			$("#edit_btn").click(function(){
				var rows = $('#grid').datagrid('getSelections');
				if(rows.length<1){
					$.messager.alert('提示','请勾选一条');
					return false;
				}
				$("#edit_id").textbox("setValue", rows[0].id);
				$("#edit_name2").textbox("setValue", rows[0].name2);
				
				$("#edit_dialog").dialog({ 
					title: '修改',    
					width: 1300,    
					height: 300,    
					closed: false,    
					cache: false,
			   		//modal: true,
			   		buttons:[{
						text:'保存',
						iconCls:'icon-save',
						handler:function(){
							
							$.post("/commonDict/noLevelMatch/updateNoLevelMatch",parent.getFormJson($('#edit_form')),function(response){
								$("#edit_dialog").dialog('close');
								$("#grid").datagrid('reload');
							})
						}
					}]
				});
				
			});
			
			
		});
			
		
		
		</script>
	</head>
	<body class="easyui-layout">
		<!-- 主表格 -->
		<div region="center" border="false">
            <div id = 'toolbar'>
                <select id="data_source_code" class="easyui-combobox" name="data_source_code" style="width:200px;">   
                        <option value="sichuan">数据共享平台</option>
                        <option value="publicService">全国建设市场公共平台</option> 
                        <option value="traffic">交通</option> 
                        <option value="water">水利</option>  
                </select>
                
                <a href="#" id="search_btn" class="easyui-linkbutton"	 data-options="iconCls:'icon-search'"  >查询</a>
                <a href="#" id='add_btn' class="easyui-linkbutton" data-options="iconCls:'icon-add'">新增</a>
                <a href="#" id='edit_btn' class="easyui-linkbutton" data-options="iconCls:'icon-edit'">编辑</a>
            </div>
            <table id="grid" data-options="toolbar:'#toolbar'" ></table>
		</div>
		
		
		<!-- 一些隐藏的对话框 -->
		<!-- 修改页 -->
		<div style="display:none" id="edit_dialog">
			<form id ="edit_form" method="post" >   
				<table width="100%">
					
					<tr style="display:none">
						<td align="right" width="20%">id:</td>
						<td width="20%"  align="left" >
							<input class="easyui-textbox"  id="edit_id"  name="id" style="width:200px"  />
						</td>
					<tr>
					
					</tr>
						<td align="right" width="20%">映射名称:</td>
						<td width="20%"  align="left">
							<select class="easyui-textbox" data-options="multiline:true"  id="edit_target" name="target"  
							style="height:160px;width:1200px">
						</td>
						<td width="20%" ></td>
					</tr>
				</table> 
			</form>
		</div> 
		
	</body>
</html>
